var string = {
	trim : function(val){
		return val.replace(/(^\s*)|(\s*$)/g, "");
	},
	isEmail: function(s){
		var email = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		if(!email.test(s)){
			return false;
		}
		return true;
	},
	isPhone:function(s){
		var mobile=/^((13[0-9]{1})|15[0-9]{1})+\d{8}$/;
		if(!mobile.test(s)){
			return false;
		}
		return true;
	},
	isIDcard: function(s){
		var idcard = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/;
		if(!idcard.test(s)){
			return false;
		}
		return true;
	},
	length:function(s){
		return s.replace(/[^\x00-\xff]/g,"**").length;
	}
}

var page = {
	next : function(){
		var pageNo = $("#id_pageNo").val();
		var newPageNo = parseInt(pageNo)+1;
		page.go(newPageNo);
	},
	prev : function(){
		var pageNo = $("#id_pageNo").val();
		var newPageNo = parseInt(pageNo)-1;
		page.go(newPageNo);
	},
	go : function(val){
		var action = $("#id_action").val();
		$("#id_pageNo").val(val);
		document.form1.action = action;
		document.form1.submit();
	}
}

function displayCondition(imgObj,trId){
	var trObj = document.getElementById(trId);
	var trs = trObj.parentNode.children;
	if(trs[1].style.display=="none"){
		for(var i=1;i<trs.length;i++)trs[i].style.display="";
		imgObj.src="./images/main/display_on.gif";
	}else{
		for(var i=1;i<trs.length;i++)trs[i].style.display="none";
		imgObj.src="./images/main/dislay_off.gif";
	}
}
